import { lazy } from "react";
var Index = lazy(() => import("../views/Index"));
var Login = lazy(() => import("../views/Login/Login"));
var Register = lazy(() => import("../views/Register/Register"));
var NotFound = lazy(() => import("../views/NotFound"));

var CustomerManage = lazy(() => import("../views/index/CustomerManage"));
var EmployeeCenter = lazy(() => import("../views/index/EmployeeCenter"));
var Home = lazy(() => import("../views/index/Home"));
var ServiceCenter = lazy(() => import("../views/index/ServiceCenter"));
var SystemManage = lazy(() => import("../views/index/SystemManage"));

var StaffManage = lazy(() =>
  import("../views/index/employeeCenter/StaffManage")
);
var RoleManage = lazy(() => import("../views/index/employeeCenter/RoleManage"));
var HistoricalData = lazy(() =>
  import("../views/index/systemManage/HistoricalData")
);
var RealtimeData = lazy(() =>
  import("../views/index/systemManage/RealtimeData")
);
var Management = lazy(() => import("../views/index/customerManage/Management"));

var routes = [
  {
    path: "/login",
    exact: true,
    rolenum: 2,
    component: Login,
  },
  {
    path: "/register",
    exact: true,
    component: Register,
  },
  {
    path: "/index",
    component: Index,
    rolenum: 1,
    children: [
      {
        path: "/index/home",
        exact: true,
        rolenum: 11,
        component: Home,
      },
      {
        path: "/index/CustomerManage",
        component: CustomerManage,
        rolenum: 14,
        children: [
          {
            path: "/index/CustomerManage/Management",
            exact: true,
            rolenum: 141,
            component: Management,
          },
          {
            from: "/index/CustomerManage",
            exact: true,
            to: "/index/CustomerManage/Management",
          },
          { component: NotFound },
        ],
      },
      {
        path: "/index/EmployeeCenter",
        component: EmployeeCenter,
        rolenum: 13,
        children: [
          {
            path: "/index/EmployeeCenter/StaffManage",
            exact: true,
            rolenum: 131,
            component: StaffManage,
          },
          {
            path: "/index/EmployeeCenter/RoleManage",
            exact: true,
            rolenum: 132,
            component: RoleManage,
          },
          {
            from: "/index/EmployeeCenter",
            exact: true,
            to: "/index/EmployeeCenter/StaffManage",
          },
          { component: NotFound },
        ],
      },
      {
        path: "/index/ServiceCenter",
        exact: true,
        rolenum: 12,
        component: ServiceCenter,
      },
      {
        path: "/index/SystemManage",
        component: SystemManage,
        rolenum: 15,
        children: [
          {
            path: "/index/SystemManage/RealtimeData", //实时数据
            exact: true,
            rolenum: 151,
            component: RealtimeData,
          },
          {
            path: "/index/SystemManage/HistoricalData", //历史数据
            exact: true,
            rolenum: 152,
            component: HistoricalData,
          },
          {
            from: "/index/SystemManage",
            exact: true,
            to: "/index/SystemManage/RealtimeData",
          },
          { component: NotFound },
        ],
      },
      {
        from: "/index",
        exact: true,
        to: "/index/home",
      },
      { component: NotFound },
    ],
  },
  {
    from: "/", //重定向路由
    exact: true,
    to: "/index",
  },
  { component: NotFound }, //404路由
];

export default routes;
